<?php
session_start();
require_once "funciones.php";
$link_caweb = con_caweb();

$q=$_POST["q"];
if ($q == "ITEM")
{
	?> Item: <select name="tmp" size="1" onchange="document.consultainventarios.busqueda.value=this.value;" class='mayusculas'> <?php
    $result ="SELECT item 
	FROM `seriales_partes` 
	WHERE LEFT( item, 1 ) = 'P'
	AND LEFT( item, 4 ) <> 'PBAT'
	AND LEFT( item, 3 ) <> 'PCJ'
	AND LEFT( item, 3 ) <> 'PDR'
	AND LEFT( item, 3 ) <> 'PDS'
	AND LEFT( item, 2 ) <> 'PF'
	AND LEFT( item, 3 ) <> 'PLM'
	AND LEFT( item, 5 ) <> 'PTCOM'
	AND LEFT( item, 5 ) <> 'PTLPT'
	AND LEFT( item, 3 ) <> 'PTO'
	AND LEFT( item, 4 ) <> 'PVEN'
	GROUP BY item order by item";
    $result=mysql_query($result,$link_caweb) or die('Error items_partes, '.mysql_error());
    echo "<option value='XXX' SELECTED>Seleccionar..</option>";
    while($row = mysql_fetch_array($result))
    {
		echo "<option value='".$row[item]."'>".$row[item]."</option>";
    }
    echo "</select>";
}

if ($q == "EMPIEZA")
{
	echo "Empieza:";
	echo "<input name='tmp' type='text' value='' id='campoempieza' onchange='document.consultainventarios.busqueda.value=this.value;'>";
}

if ($q == "CONTIENE")
{
	echo "Contiene:";
	echo "<input name='tmp' type='text' value='' id='campocontiene' onchange='document.consultainventarios.busqueda.value=this.value;'>";
}

if ($q == "NOCONTIENE")
{
	echo "No Contiene:";
	echo "<input name='tmp' type='text' value='' id='camponocontiene' onchange='document.consultainventarios.busqueda.value=this.value;'>";
}

?>